package com.bzzoneit.newsys.utils.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Repository;

import com.bzzoneit.newsys.service.admin.SchedulerService;

@Repository
public class InitSchedulerJobListener
implements ApplicationListener 
{
	@Autowired
	private SchedulerService schedulerService;
	protected static Logger logger =  LoggerFactory.getLogger("service");
	
	@Override
	public void onApplicationEvent(ApplicationEvent arg0) {
		logger.info("启动任务调度开始");
		try {
			schedulerService.startScheduler();
		} catch (Exception e) {
			e.printStackTrace();
			logger.info("启动任务调度出错"+e);
			return ;
		}
		logger.info("启动任务调度完成");
	}

	
}

